#pragma once
#include "cybertron/node/WorkAppWithHotArea.hpp"
//#include "AgentClient.hpp"
#include "cybertron/node/AgentClient.hpp"
#include "Node/Common.pb.h"
#include "Node/Agent.pb.h"
#include "cybertron/network/Message.hpp"
#include <iostream>

// #include "cybertron/core/ConfigureClient.hpp"
#include "TimeServer.hpp"

#define theApp GET_APP_INSTANCE(TheApp)
class TheApp : public cybertron::WorkApp
{
public:
	TheApp();
	~TheApp();
	virtual void onWorkNodeStop();
	virtual bool init(int argc, char* argv[]);
	virtual bool onTaskStartBefore();
	virtual bool onTaskStart();
	virtual bool onTaskRunning();
	virtual bool onTaskStop();

protected:

	void runDaemon();

protected:
	void getVerion();
	int run();
	// bool setNodeTimeConfig();
private:
	bool mbRunning;
	std::shared_ptr<TimeServer> mpServer;
	Common::EWorkNodeType mWorkNodeType;
	std::shared_ptr<cybertron::ConfigureClient> mpConfigCenter;
	std::string mNodeTimeIp;
	int mNodeTimePort;
};

